#ifndef DOTVIEW_H
#define DOTVIEW_H

#include <QWidget>
#include <QMouseEvent>
#include <QMargins>
#include "../Settings/GameSettings.h"

class QPainter;
class DotController;
class Dot;
class QTextDocument;

class DotView : public QWidget
{
Q_OBJECT
public:
    DotView(QWidget *parent = 0);

public:
    void addListener(DotController *pController);

    void loadDescription(const QString &fileName);
    void setDescription(const QString &text);
    void loadCommandsDesc(const QString &fileName);
    void setCommandsDesc(const QString &text);
    void setHowToPlayEnabled(bool bEnable);
    void setShowCommandsEnabled(bool bEnable);

signals:

protected:
    void paintEvent(QPaintEvent *pEvent);
    void mousePressEvent(QMouseEvent *pEvent);

public slots:
    void needToResized(int nWidth,int nHeight);
    void showHowToPlay();
    void showCommands();

private:
    void drawDots(QPainter *pDC);
    void drawLines(QPainter *pDC);
    void drawCellOwnership(QPainter *pDC);
    void drawBG(QPainter *pDC);
    void paintDescription(QPainter *painter,QTextDocument *pTextDoc);

private:
    DotController *mpController;    
    QTextDocument *mpDocDesc,*mpDocCommands;
    bool mbDrawHowToPlay,mbDrawCommands;
};

#endif // DOTVIEW_H
